﻿@{
    <!-- 上一页 -->
    var prePageClass = "";
    var prePageUrl = "";
    if (ViewBag.page > 1)
    {
        prePageClass = "";
        prePageUrl = Url.Action("Index", "Blog", new { page = (ViewBag.page - 1) });
    }
    else
    {
        prePageClass = "disabled";
        prePageUrl = "#";
    }
    <!-- 下一页 -->
    var nextPageClass = "";
    var nextPageUrl = "";
    if (ViewBag.page > (ViewBag.postCount/10))
    {
        nextPageClass = "disabled";
        nextPageUrl = "#";
    }
    else
    {
        nextPageClass = "";
        nextPageUrl = Url.Action("Index", "Blog", new { page = (ViewBag.page + 1) });;
    }
    //页码
    var page = ViewBag.page;
    var pageCount = Math.Ceiling(ViewBag.postCount / 10f);
}


<ul class="pager">

    <li class="@prePageClass"><a href="@prePageUrl" target="_self">上一页</a></li>
    <li>@(page)/@(pageCount)</li>
    <li class="@nextPageClass"><a href="@nextPageUrl" target="_self">下一页</a></li>
</ul>